<?php
if(isset($_GET['tab'])) {
    $_SESSION['active'] = $_GET['tab'];
}
?>

<?php
include($classes_path.'/class.mainMenu.php');
$menuclass = new mainMenu();
$menuclass->set_page($pageid);
$menuclass->set_id($article);
$mainMenu = $menuclass->get_mainMenu();
$subMenu = $menuclass->get_subMenu();


if(!empty($mainMenu)) {
    print('<ul id="menu">'.PHP_EOL);
    foreach($mainMenu as $item) {
        ?>
<li<?php
        switch($pageid) {
            case $item['id'];
            case $item['parent'];
                print(' class="active"');
                break;
        }
            ?>>
    <a href="page/<?php print($item['id'].'/'.str_replace( " ", "-", $item['name'])); ?>"><?php print($item['name']); ?></a>
</li>
    <?php
    }
    print('</ul>');
    print('<div class="clear"></div>');

    if(!empty($subMenu)) {
        print('<div id="sublinks">');
        foreach($subMenu as $item) {
            ?>
<ul>
    <li>
        <a href="page/<?php print($item['id'].'/'.str_replace( " ", "-", $item['name'])); ?>"><?php print($item['name']); ?></a>
    </li>
</ul>
        <?php
        }
        print('</div>');
    }
}
?>

